package org.example;

// 第二章挑战
class AlgorithmChallenge implements CodeChallenge {
    private String description;

    public AlgorithmChallenge(String desc) {
        this.description = desc;
    }

    @Override
    public String getDescription() {
        return "<html><div style='color:#66CCFF;'>" +
                "<b>【语法修复挑战】</b><br><br>" +
                "修复以下代码中的语法错误:<br>" +
                "<font color='#FF9999'>public class Test {</font><br>" +
                "<font color='#FF9999'>    public static void main(String[] args) {</font><br>" +
                "<font color='#FF9999'>        System.out.println(\"Hello\") </font><font color='#FF0000'>← 这里有问题</font><br>" +
                "<font color='#FF9999'>    }</font><br>" +
                "<font color='#FF9999'>}</font>" +
                "</div></html>";
    }

    @Override
    public String getHint() {
        return null;
    }

    @Override
    public boolean validateSolution(String code) {
        return code.contains("void quickSort") &&
                code.contains("int partition") &&
                code.contains("while(i <= j)");
    }
}
